<#import "/spring.ftl" as spring />
<#import "../inspector-time-macros.ftl" as imacro />
<html>
<head>
	<title>Inspector Company</title>
</head>
<body>
<div id="content">

<h1>PAYMENT GATEWAY</h1>

<p>Enter the payment gateway details you received from Authorize.net.  
   Contact <a href="http://www.authorize.net/" target="_new">http://www.authorize.net/</a> for more information.</p>

<@spring.bind "inspectorCompany.simLoginId" />
<#if (spring.status.errors.globalErrors?size > 0 ) >
    <div class="errors">
        <@spring.message spring.status.errors.globalError /><BR/>
    </div>
    <br />
</#if>

<#-- Did we get an error from Authorize.net? -->
<#assign authorize_net_is_error = false />
<#assign authorize_net_error_body = "" />
<#list spring.status.errors.globalErrors as error>
	<#if error.code == "inspector.company.invalid.transaction.log">
		<#assign authorize_net_is_error = true />
		<#assign authorize_net_error_body = error.defaultMessage />
	</#if>
</#list>

<#-- Display the details of the sample request sent to authorize.net for debugging help -->
<#if authorize_net_is_error>
	<p class="errors">If you are sure you entered the correct Login ID and Transaction Key then you will need to contact <a href='http://authorize.net/' target="_blank">Authorize.Net</a> customer support to find out why the sample transaction failed.  They can be reached at 877-447-3938, between the hours of 6 AM and 6 PM Pacific Time, Monday through Friday.  You can also e-mail them at support@authorize.net.  We suggest you include your login ID, your transaction key, and the full contents of the sample transaction request.  Just copy everything from the box below and paste it into your e-mail to support@authorize.net.  Then they should be able to identify and resolve the problem quickly.</p>
	<form action="null" method="post">
		<textarea rows='4' cols='68'>${authorize_net_error_body}</textarea>
	</form>
	<p class="errors">You should also log in to the Authorize.Net <a href="https://account.authorize.net/" target="_blank">Merchant Interface</a> and make sure your Payment Gateway is configured properly.  Refer to the online <a href="http://authorize.net/support/knowledgebase/" target="_blank">Knowledge Base</a> for more information.  Note that Inspector Time uses the <a href="http://developer.authorize.net/guides/SIM/" target="_blank">Server Integration Method (SIM)</a> to communicate payment requests to Authorize.Net on your behalf.</p> 
</#if>

<form action="editPaymentGateway.html" method="post">
	<@spring.formHiddenInput "inspectorCompany.id" />
	
	<table class="formTable twoColForm">
		<tr>
			<th><span class="required">*</span>Login Id</th>
			<td><@spring.formInput "inspectorCompany.simLoginId", 'size="25"'/></td>
		</tr>
		<tr>
			<th><span class="required">*</span>Transaction Key</th>
			<td><@spring.formPasswordInput "inspectorCompany.simTransactionKey", 'size="25"'/></td>
		</tr>
		<tr>
			<td></td>
			<td>
				<input type="submit" value="SAVE" class="formButton" />
				<a href="paymentSettings.html" class="formLink">-CANCEL-</a>
				<a href="removePaymentGateway.html" class="formLink">-DISABLE-</a>
			</td>
		</tr>
	</table>
	
	<div class="requiredText">*INDICATES REQUIRED FIELDS</div>

</form>

</div>
</body>
</html>
